<link href="<?php echo base_url()?>/style/validationEngine.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="<?php echo base_url()?>script/jquery.validationEngine-<?php echo $this->lang->lang()!=''?$this->lang->lang():'en';?>.js"></script>
<script type="text/javascript" src="<?php echo base_url()?>script/jquery.validationEngine.js"></script>
<div class="middleFront">
    <div class="navigation fourthPageSprite"></div>
    <div class="infoText infoTitle">
        <?php echo lang('write_message_check');?>
    </div>
    <ul class="informationHelp">
        <li>
            <?php echo lang('write_message_explain_check');?>
        </li>
    </ul>
    <div class="infoText infoTitle">
        <?php

                echo lang('message_will_be_send');

        ?>
    </div>
    <ul class="informationHelp">
        <?php
            foreach ($representatives as $key=>$val) {

        ?>
        <li>
            <?php
                $pretstavnik = "";
                $pretstavnik .= "<b>".$val->rep_name." ".$val->rep_surname."</b>";
                switch ($val->role_id){
                    case 1:
                        $pretstavnik .= ", ".lang('pratenik').".";
                        break;
                    case 2:
                        $pretstavnik .= ", ".lang('sovetnik')." ".lang('message_representative_from_mun')." \"".$this->session->userdata('municipality_name')."\".";
                        break;
                    case 3:
                        $pretstavnik .= ", ".lang('gradonacalnik')." ".lang('message_representative_from_mun')." \"".$this->session->userdata('municipality_name')."\".";
                        break;
                }
                echo $pretstavnik;
            ?>
        </li>
        <?php
            }
        ?>
    </ul>
        <?php
            if(validation_errors()){
        ?>
        <div class="errorMessageDiv">
        <?php
              echo validation_errors();
        ?>
        </div>
        <?php
            }

        ?>
    <div class="formHolder">
        <table width="100%" border="0" class="mainTableFormHolder">
            <tr>
                <td>
                    <table class="leftTable" width="100%">
                        <tr>
                            <td width="45%">
                                <b><?php echo lang('sender_name')?></b>
                                <img src="<?php echo base_url()."style/images/musthave.png"?>" alt="<?php echo lang('case_field_required')?>" title="<?php echo lang('case_field_required')?>" />
                            </td>
                            <td width="55%"><?php echo $sendData['sender_name'];?></td>
                        </tr>
                        <tr>
                            <td width="45%">
                                <b><?php echo lang('sender_address')?></b>
                                <img src="<?php echo base_url()."style/images/musthave.png"?>" alt="<?php echo lang('case_field_required')?>" title="<?php echo lang('case_field_required')?>" />
                            </td>
                            <td width="55%"><?php echo $sendData['sender_address'];?></td>
                        </tr>
                        <tr>
                            <td width="45%">
                                <b><?php echo lang('sender_city')?></b>
                                <img src="<?php echo base_url()."style/images/musthave.png"?>" alt="<?php echo lang('case_field_required')?>" title="<?php echo lang('case_field_required')?>" />
                            </td>
                            <td width="55%"><?php echo $sendData['sender_city'];?></td>
                        </tr>
                        <tr>
                            <td width="45%">
                                <b><?php echo lang('municipality_id')?></b>
                                <img src="<?php echo base_url()."style/images/musthave.png"?>" alt="<?php echo lang('case_field_required')?>" title="<?php echo lang('case_field_required')?>" />
                            </td>
                            <td width="55%"></td>
                        </tr>
                    </table>
                </td>
                <td>
                    <table class="rightTable">
                        <tr>
                            <td width="45%">
                               <b><?php echo lang('sender_email')?></b>
                               <img src="<?php echo base_url()."style/images/musthave.png"?>" alt="<?php echo lang('case_field_required')?>" title="<?php echo lang('case_field_required')?>" />
                            </td>
                            <td width="55%"><?php echo $sendData['sender_email']; ?></td>
                        </tr>
                        <tr>
                            <td width="45%">
                               <b><?php echo lang('sender_confirm_email')?></b>
                               <img src="<?php echo base_url()."style/images/musthave.png"?>" alt="<?php echo lang('case_field_required')?>" title="<?php echo lang('case_field_required')?>" />
                            </td>
                            <td width="55%"><?php echo $sendData['sender_confirm_email']; ?></td>
                        </tr>
                        <tr>
                            <td width="45%">
                               <b><?php echo lang('sender_phone')?></b>
                            </td>
                            <td width="55%"><?php echo $sendData['sender_phone']; ?></td>
                        </tr>
                        <tr>
                            <td width="45%">
                               &nbsp;
                            </td>
                            <td width="55%">&nbsp;</td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="textareaHelper">
                    <b><?php echo lang('message')?></b>
                    <img src="<?php echo base_url()."style/images/musthave.png"?>" alt="<?php echo lang('case_field_required')?>" title="<?php echo lang('case_field_required')?>" />
                </td>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <td colspan="2" class="textareaHelper">
                    <textarea name="message" id="message" class="stiliziran textMail validate[required]" cols="45" rows="15" readonly><?php echo $sendData['message']; ?></textarea>
                </td>
            </tr>
            <tr>
                <td class="textareaHelper">
                    <div class="returnBack">
                        <a href="<?php echo base_url().$this->lang->lang()."/messages/writeMessage/".$sendData['role_id']."/".$sendData['rep_id']."/true"?>"><?php echo lang('edit_message')?></a>
                    </div>
                </td>
                <td class="textareaHelper">
                    <div class="sendMessage">
                        <a href="<?php echo base_url().$this->lang->lang()."/messages/sendMessage"?>"><?php echo lang('send_message')?></a>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div class="cleardiv"></div>
</div>
<script type="text/javascript">
    $(document).ready(function(){
//        $("form[name=messageForm]").validationEngine();
    });
    $('#preview_message').click(function(){
        $('form[name=messageForm]').submit();
    });
</script>

